﻿<UserControl x:Class="IndexMarkSilverlightClient.Views.Controls.ReportsControls.AvgIndexes"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:my="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:chartingprimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit" xmlns:sharedcontrols="clr-namespace:SharedCode.Controls;assembly=SharedCode" mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="6*"/>
        </Grid.RowDefinitions>


        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="140"/>
            <ColumnDefinition Width="50*"/>

        </Grid.ColumnDefinitions>

        <StackPanel Orientation="Vertical" Width="auto" Grid.Row="0" Grid.Column="0" Margin="4,4,4,4">
            <TextBlock x:Name="txtBlock" Text="Распределение по:"/>
            <ComboBox SelectionChanged="ComboBox_SelectionChanged" x:Name="TypeCB" Width="auto">
                <ComboBox.Items>
                    <ComboBoxItem Content="Кафедрам" IsSelected="True"/>
                    <ComboBoxItem Content="Факультетам" />
                    <ComboBoxItem Content="Должностям"/>
                    <ComboBoxItem Content="Разделам ИС"/>
                </ComboBox.Items>
            </ComboBox>
        </StackPanel>

        <ListBox BorderBrush="Gray" BorderThickness="2"  Margin="4,4,4,4"
                     Background="Transparent" x:Name="DepsLB" MinWidth="200" Grid.Row="0" Grid.Column="1" ItemsSource="{Binding}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <CheckBox IsChecked="{Binding Check, Mode=TwoWay}" Content="{Binding Name}" Click="CheckBox_Click" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <my:Chart Grid.Row="1" x:Name="IndexesChart" Grid.ColumnSpan="2" BorderBrush="Transparent">
            <my:Chart.Template>
                <ControlTemplate TargetType="my:Chart">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <datavis:Title Grid.Row="0" Content="{TemplateBinding Title}" Style="{TemplateBinding TitleStyle}" />
                            <Grid Grid.Row="1" Margin="0,0,0,15">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}" Grid.Column="0" >
                                    <Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
                                    <Border Canvas.ZIndex="10" BorderBrush="#FF919191" BorderThickness="1" />
                                </chartingprimitives:EdgePanel>
                            </Grid>
                            <datavis:Legend x:Name="Legend" Header="{TemplateBinding LegendTitle}" Style="{TemplateBinding LegendStyle}" Grid.Row="2"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </my:Chart.Template>

            <my:Chart.Series>
                <my:ColumnSeries Title="Итоговые индексы" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}"/>
                <my:ColumnSeries Title="Индексы лидерства" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}"/>
                <my:ColumnSeries Title="Индексы гармонии" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}"/>
            </my:Chart.Series>
        </my:Chart>

        <sharedcontrols:LoadingBar x:Name="loadingBar" VerticalAlignment="Center" Action="загрузка" HorizontalAlignment="Center" Grid.RowSpan="3" Grid.ColumnSpan="3"/>

    </Grid>
</UserControl>
